home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / appkit.756 < prev    next >
Text File  |  1992-02-06  |  3KB  |  53 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f2\fswiss Helvetica;}
  2. \paperw13040
  3. \paperh10140
  4. \margl80
  5. \margr120
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ul0\fs28 TextField color\
  8. \
  9.  
  10. \fi-420\li420 Q:  I am trying to set the background color on my TextField.  It seems that the color is being ignored.  What is going on?  Here is my code, which uses a color well:\
  11. \
  12.  
  13. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\f1\fs24\fc0 - setBackgroundColorWithWell:sender\
  14. \{\
  15.     [myTextField setBackgroundColor:[sender color]];\
  16.     [myTextField display];\
  17.     return self;\
  18. \}\
  19.  
  20. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\fs28\fi-420\li420 \
  21.  
  22. \fi0\li0 \
  23.  
  24. \fi-420\li420 A:  You must set shades in both the color model and the 
  25. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\fc0 gray
  26. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fi-420\li420  model separately.  The Appkit figures out what type of machine is being used and sets the window depth for the window accordingly.  \
  27. \
  28.  
  29. \fi0 The model of being able to specify colors and 
  30. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\fc0 gray
  31. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\li420  separately can be useful; typically you don't want to give a TextField some random color when it is displayed in a monochrome window.  For instance, yellow 12 point text on a red background is usually reduced a few pixels when displayed in a 2-bit window.  Thus, in most cases you might want a TextField to remain black on white on the monochrome display.  Or you might want to just alter the foreground while always keeping the background white.  If you do want the 
  32. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\fc0 gray
  33. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\li420  and color values to track, then you have to set them both, as shown below.\
  34.  
  35. \li0 \
  36.  
  37. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\f1\fs24\fc0 - setBackgroundColorWithWell:sender\
  38. \{\
  39.     [myTextField setBackgroundColor:[sender color]];\
  40.     [myTextField setBackgroundGray: NXGrayComponent([sender color]]);\
  41.     [myTextField display];\
  42.     return self;\
  43. \}\
  44.  
  45. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\fs28\fc0 \
  46. \
  47. QA756\
  48. \
  49. Not valid for 1.0\
  50. Valid for 2.0\
  51. \
  52.  
  53.